<?php


namespace App\Http\Controllers;
use App\Models\houselist;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
class taxi extends Controller
{
    public function houselist(Request $request)
    {
        $search = isset($_GET['search'])?$_GET['search']:'';
        $m=1;
        $page=$request->input('page');
        $page=isset($page)?$page:1;
        $n=($page-1)*$m;
        $houselist=new houselist();
        $search=$request->input("search");
        $houselistRows=$houselist
            ->Where('hsite','like','%'.$search.'%')
            ->skip($n)
            ->take($m)
            ->get();
        $count=$houselist
            ->Where('hsite','like','%'.$search.'%')
            ->get()
            ->count('hid');

        return view('houselist', ['houselistRows'=>$houselistRows,'m'=>$m,'count'=>$count,'page'=>$page,'search'=>$search]);
    }
    public function housestyle(Request $request,$id)
    {
        $style=new houselist();
        $styleRows=$style->where('hid',$id)->get();
        return view('housestyle', ['styleRows'=>$styleRows]);
    }

    public function rentstyle(Request $request,$id)
    {
        $style=new houselist();
        $styleRows=$style->where('hid',$id)->get();
        return view('housestyle', ['styleRows'=>$styleRows]);
    }
}
